#!/usr/bin/env python
# -*-coding:utf-8 -*-

"""
filter(function or None, iterable) --> filter object

Return an iterator yielding those items of iterable for which function(item)
is true. If function is None, return the items that are true.
返回一个生成器
"""

nums = [1, 2, 3, 4, 5, 6, 7, 8, 9]


def fn(n):
    return n % 2 == 1


f = filter(fn, nums)  # 返回一个生成器
# newList = list(f)
newList = [i for i in f]
print(newList)
